<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt"%>

<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";		
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <title>文件上传</title>
    
    <c:import url="/liger/liger.jsp"></c:import>
    
    <script type="text/javascript">
	function f_import(id){
		$.ligerDialog.open({ height: 200,width:400,url: 'data/imp_select.jsp?fileId='+id });
	}
	
	function f_fileDel(url){
		$.ligerDialog.waitting("操作进行中,请稍后...");
		$.ajax({
    		url:url,
    		dataType:'json',
    		success: function(msg) {
                  alert(msg.msg);
            },
            error: function(XMLHttpRequest, textStatus, errorThrown) {
            	alert("操作错误: "+XMLHttpRequest.status);
	   			//alert(XMLHttpRequest.status);
                //alert(XMLHttpRequest.readyState);
                //alert(textStatus);
            },
            complete: function(XMLHttpRequest, textStatus) {
               $.ligerDialog.closeWaitting();
               location.href='<%=path%>/uploadController.do?filesList';
            }
    	});
	}
	</script>


    <style type="text/css">
    
    .list{background-color:#004080;}
    
    .list th{background-color:#004080;color:#ffffff;font-weight:600;}
    
    .list td{background-color:#fff;}
    </style>
  </head>
  
  <body>
     <table id="mytable" width="100%"  border=0 cellspacing=1 cellpadding=0 class="list">
    	<tr>
    	<th>序号</th>
    	<th>文件名</th>
    	<th>数据交互</th>
    	<th>保存文件</th>
    	<th>保存路径</th>
    	<th>文件大小</th>
    	<th>后缀</th>
    	<th>上传时间</th>
    	<th>删除</th>
    	</tr>
    	<c:forEach items="${filesList}" var="files" varStatus="index">
    		<td>${(page.pageNumber-1)*page.perPageRow+index.index+1}</td>
    		<td><a href="<%=path%>/uploadController.do?down&id=${files.id}">${files.fileName}</a></td>
    		<td><a href="javascript:f_import('${files.id}');">导入数据库</a></td>
    		<td><a href="<%=path%>/impController.do?wxImpl&saveFileId=${files.id}">测试</a></td>
    		<td>${files.flagName}</td>
    		<td>${files.filePath}</td>
    		<td><fmt:formatNumber value="${files.fileSize/1024/2014}" maxFractionDigits="4"></fmt:formatNumber>MB</td>
    		<td>${files.fileSubffix}</td>
    		<td>${files.createDate}</td>
    		<td><a href="javascript:f_fileDel('${pageContext.request.contextPath}/uploadController.do?filesDel&id=${files.id}');">删除</a></td>
    		</tr>
    	</c:forEach>
    </table>
    
    
    <c:set var="path" value="${pageContext.request.contextPath}/uploadController.do?filesList"></c:set>
    <a href="${path}&pageNumber=1">首页</a>
    <a href="${path}&pageNumber=${page.pageNumber-1}">上一页</a>
	<a href="${path}&pageNumber=${page.pageNumber+1}">下一页</a>
	<a href="${path}&pageNumber=${page.totlePageNumber}">尾页</a>
	
	共 ${page.pageNumber}/${page.totlePageNumber }  页
    
  </body>
</html>



